@extends('admin::layouts.master')
@section('content')
    <div class="card" id="app">
        <div class="card-header">订单管理</div>
        <div class="tab-container">
            <ul role="tablist" class="nav nav-tabs">
                <li class="nav-item"><a href="/buy/dingdan" class="nav-link active">订单列表</a></li>
            </ul>
            <div class="card card-contrast card-border-color-success">
                <div class="card-body">
                    <table class="table">
                        <thead>
                        <tr>
                            <th style="width: 10%;">编号</th>
                            <th>订单编号</th>
                            <th>用户名</th>
                            <th>是否发货</th>
                            <th>创建时间</th>
                            <th>订单详情</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($data as $d)
                            <tr>
                                <td>{!! $d['id'] !!}</td>
                                <td>{!! $d['orderId'] !!}</td>
                                <td>{!! $d['user_id']!!}</td>
                                <td>
                                    {{--<form action="{{route('fahuo',$d['orderId'])}}" method="get">--}}
                                        {{--@csrf--}}
                                    <button type="submit" class="btn btn-space btn-primary" onclick="shi(this,'{{$d["orderId"]}}')">是</button>
                                    {{--</form>--}}

                                </td>
                                <td>{!! $d['created_at'] !!}</td>

                                <td>
                                    <a href="{{route('more',$d['orderId'])}}" class="btn btn-space btn-success">订单详情</a>
                                </td>
                                    </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="float-right">
        {!!  $data->links() !!}
    </div>


    <script>
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
    </script>
    <script>



        function shi(obj,id) {
            // alert(123);
            $(obj).attr("disabled", true)
            $.ajax({
                url:'/fahuo/'+id,
                type:'get',
                datatype:'json',
                success:function (res) {
                    // console.log(res)
                    if (res.volid){
                        alert('发货成功')
                    }
                }
            })
        }
    </script>
@endsection
